// 动态加载图片宽高
export function loadImageDimensions(item) {
    return new Promise((resolve, reject) => {
        const img = new Image();
        img.src = item.src;
        img.onload = () => resolve({ width: img.width, height: img.height });
        img.onerror = reject;
    });
}

// 动态加载视频宽高
export function loadVideoDimensions(item) {
    return new Promise((resolve, reject) => {
        const video = document.createElement('video');
        video.src = item.videoSrc;
        video.onloadedmetadata = () => {
            resolve({ width: video.videoWidth, height: video.videoHeight });
        };
        video.onerror = reject;
    });
}